<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Section 8.5.3: Analytic center of a set of linear inequalities</title>
<link rel="canonical" href="http://cvxr.com/cvx/examples/cvxbook/Ch08_geometric_probs/html/analytic_center.html">
<link rel="stylesheet" href="../../../examples.css" type="text/css">
</head>
<body>
<div id="header">
<h1>Section 8.5.3: Analytic center of a set of linear inequalities</h1>
Jump to:&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#source">Source code</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#output">Text output</a>
&nbsp;&nbsp;&nbsp;&nbsp;
Plots
&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../../index.html">Library index</a>
</div>
<div id="content">
<a id="source"></a>
<pre class="codeinput">
<span class="comment">% Boyd &amp; Vandenberghe "Convex Optimization"</span>
<span class="comment">% Jo&Atilde;&laquo;lle Skaf - 04/29/08</span>
<span class="comment">%</span>
<span class="comment">% The analytic center of a set of linear inequalities and equalities:</span>
<span class="comment">%           a_i^Tx &lt;= b_i   i=1,...,m,</span>
<span class="comment">%           Fx = g,</span>
<span class="comment">% is the solution of the unconstrained minimization problem</span>
<span class="comment">%           minimize    -sum_{i=1}^m log(b_i-a_i^Tx).</span>

<span class="comment">% Input data</span>
randn(<span class="string">'state'</span>, 0);
rand(<span class="string">'state'</span>, 0);
n = 10;
m = 50;
p = 5;
tmp = randn(n,1);
A = randn(m,n);
b = A*tmp + 10*rand(m,1);
F = randn(p,n);
g = F*tmp;

<span class="comment">% Analytic center</span>
cvx_begin
    variable <span class="string">x(n)</span>
    minimize <span class="string">-sum(log(b-A*x))</span>
    F*x == g
cvx_end

disp([<span class="string">'The analytic center of the set of linear inequalities and '</span> <span class="keyword">...</span>
      <span class="string">'equalities is: '</span>]);
disp(x);
</pre>
<a id="output"></a>
<pre class="codeoutput">
CVX Warning:
   Models involving "log" or other functions in the log, exp, and entropy
   family are solved using an experimental successive approximation method.
   The method requires multiple calls to the solver, so it can be slow; and
   in certain cases it fails to converge. See Appendix D of the the user's
   guide for more information about this method, and for instructions on how
   to suppress this warning in the future.
 
Successive approximation method to be employed.
   sedumi will be called several times to refine the solution.
   Original size: 160 variables, 105 equality constraints
   50 exponentials add 400 variables, 250 equality constraints
-----------------------------------------------------------------
 Cones  |             Errors              |
Mov/Act | Centering  Exp cone   Poly cone | Status
--------+---------------------------------+---------
 50/ 50 | 2.303e+00  3.573e-01  5.090e-08 | Solved
 49/ 50 | 1.788e-01  2.265e-03  2.233e-07 | Solved
 30/ 50 | 1.486e-02  1.622e-05  2.066e-07 | Solved
  0/ 50 | 8.671e-04  2.138e-07  2.038e-07 | Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): -64.8504
The analytic center of the set of linear inequalities and equalities is: 
   -0.3618
   -1.5333
    0.1387
    0.2491
   -1.1163
    1.3142
    1.2303
   -0.0511
    0.4030
    0.1248

</pre>
</div>
</body>
</html>